package sjd.ahsj.springbootmybatisplusoracle.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;
import sjd.ahsj.springbootmybatisplusoracle.entity.Anime;
import com.baomidou.mybatisplus.mapper.BaseMapper;

/**
 * <p>
 * 动漫 Mapper 接口
 * </p>
 *
 * @author zhanghaogao
 * @since 2018-09-18
 */
public interface AnimeMapper extends BaseMapper<Anime> {

    /**
     * 减少订阅
     *
     * @param id
     * @return
     */
    @Update("update anime set subscription_num=subscription_num-1 where id =#{id}")
    int delSubscription(@Param("id") Long id);

    /**
     * 增加订阅
     *
     * @param id
     * @return
     */
    @Update("update anime set subscription_num=subscription_num+1 where id =#{id}")
    int addSubscription(@Param("id") Long id);

    /**
     * 增加阅读量
     *
     * @param id
     * @return
     */
    @Update("update anime set read_num=read_num+1 where id =#{id}")
    int addRead(@Param("id") Long id);
}
